package com.ruoyi.jdbc.controller;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.jdbc.domain.Order;
import com.ruoyi.jdbc.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("/insert")
    public AjaxResult insert(@RequestBody Order o) {
        return orderService.insert(o);
    }

    @GetMapping("/queryById")
    public AjaxResult queryById(Long id) {
        return orderService.queryById(id);
    }

    @GetMapping("/queryByTime")
    public AjaxResult queryByTime(LocalDateTime start, LocalDateTime end) {
        return orderService.queryByTime(start, end);
    }
}
